﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VonaJobs.DAL.DAO;
using VonaJobs.DAL.Gatway;

namespace VonaJobs.BLL
{
    public class MemberTypeManager
    {
        MemberTypeGateway gateway=new MemberTypeGateway();

        public string SaveMemberType(MemberType memberType)
        {
            try
            {
                if (!HasthisMembershipExist(memberType))
                {
                    return gateway.SaveNewMemberType(memberType);
                }
                
            }
            catch (Exception)
            {
                
                throw;
            }
            return "Member type created successfully";
        }

        private bool HasthisMembershipExist(MemberType memberType)
        {
            try
            {
                return gateway.HasThisMemebrShipExist(memberType);
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        public string UpdateMemberType(MemberType memberType)
        {
            try
            {
                return gateway.UpdateMemberType(memberType);
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        public List<MemberType>GetAllMemberType()
        {
            try
            {
                return gateway.GetAllMemberType();
            }
            catch (Exception)
            {
                
                throw;
            }
        }
    }
}